<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%;">
<head>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<title>管理系统 - 登录</title>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>
</head>

<body style="width: 100%; height: 100%; margin: 0px;"
	class="umu-theme-gray">
	<header class="navbar navbar-fixed-top umu-header" style="box-shadow: 0 2px 2px rgba(0,0,0,.15); height: 80px; padding: 10px 0;">
		<div class="container-fluid clearfix">
			<div class="navbar-header" style="padding: .5em;">
			  <img src="${ctx.resource}/images/system-logo.png" class="pull-right" style="padding-left: 60px;" />
			</div>
		</div>
	</header>
	<div class="umu-form-login">

		<form id="login-form" class="login-form clearfix"
			action="${ctx.host}/j_spring_security_check" method="POST"
			data-validate="true">

			<h2>培训数据管理平台</h2>

			<c:if test="${not empty errorMessage}">
				<div class="alert alert-danger">
					<i class="glyphicon glyphicon-remove"></i>&nbsp;&nbsp;
					<fmt:message key="${errorMessage}" />
				</div>
			</c:if>

			<div class="login-input-area">
              <div class="input-group input-group-lg">
                <span class="input-group-addon"><span
                  class="glyphicon glyphicon-user" aria-hidden="true"></span></span> <input
                  type="text" class="form-control" placeholder="账号" name="j_username"
                  value="" data-validate="required" />
              </div>
        
              <div class="input-group input-group-lg">
                <span class="input-group-addon"><span
                  class="glyphicon glyphicon-lock" aria-hidden="true"></span></span> <input
                  type="password" class="form-control" placeholder="密码"
                  name="j_password" data-validate="required" />
              </div>
        
              <div class="form-inline clearfix text-right" style="margin-top: 40px;">
                <button
                  class="btn btn-lg btn-block btn-success"
                  type="submit">登录</button>
              </div>
            </div>
            
            <div class="auto-login-area hide" style="text-align: center;">
              <img src="${ctx.resource}/images/auto-loading.gif" alt="" style="height: 200px;width: 200px;display: inline-block;" />
              <p style="margin-top: 20px;">正在自动登录</p>
			</div>

		</form>

	</div>

	<%@ include file="/WEB-INF/include/script.jsp"%>
    <c:if test='${not empty cookie["leadership-username"]}'>
        <d:resource root="${ctx.resource}/build" type="script" src="js/page/auto-login.js" />
          <script type="text/javascript">
              require([ 'page/auto-login' ], function(page) {
                  page.init({
                    name: '${cookie["leadership-username"].value}',
                    errorMessage: '${errorMessage}'
                  });
              })
          </script>
      </c:if>

</body>
</html>